home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 27
/
027.d81
/
disk master
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
9KB
|
235 lines
210 clr:gosub 1980:dim d$(225),x$(225),u(225,2),b$(255):ft$="seqpgmusrrel"
220 d1=8 :rem - master disk device#
230 d1$="0" :rem - master disk drive#
240 d2=8 :rem - catalog disk device#
250 d2$="0" :rem - catalog disk drive#
260 bf=18 :rem - 39 for 8050 drives
270 : :rem - 18 for all others
280 q$=chr$(34):close15:open15,d1,15:gosub2360
290 cx=2:gosub1990: print"reading directory cross reference"
300 close 5: open 5,d1,5,d1$+":disk mstr xref,s,r"
310 input#15,en,em$,et,es: if en=62 then 340
320 if en>0 then 2270
330 input#5,x$(nx),v:gosub 2260:u(nx,1)=v:u(v,2)=1:nx=nx+1:if ss=0 then330
340 close 5: cx=0: gosub 1980: print" 0 - done"
350 print" 1 - update master directory"
360 print" 2 - delete disk entry from master"
370 print" 3 - display selected directory"
380 print" 4 - list disk id's & names"
390 print" 5 - find specified file"
400 gosub 1990: print"enter desired function: ";
410 gosub 1960: if c$="0" then print"[147]": goto 2330
420 v=val(c$): on v goto 430,960,1010,1140,1600: goto 410
430 cx=0: print"[147] insert disk to be cataloged": close 5: close 15
440 if(d1<>d2)or(d1$<>d2$)thenprint" in device#";d2;" drive# ";d2$
450 print:gosub 1990:print" press c[146] to catalog, q[146] to quit"
460 get c$: if c$="q" then gosub 2340: goto 340
470 if c$<>"c" then 460
480 gosub 1990:print"ok, reading bam ...":open 15,d2,15,"i"+d2$:gosub 2260
490 md=0: open 5,d2,5,"#0": gosub 2260: t=bf: s=0: gosub 2140
500 mf=144: if bf=18 then 560
510 mf=224: dn$="": for z=6 to 21: dn$=dn$+b$(z): next z
520 s$=b$(24): if b$(25)<>chr$(0) then s$=s$+b$(25)
530 df$=b$(27)+b$(28):nb=0: gosub 2130
540 for z=6 to 251 step 5: if z<>196 then nb=nb+asc(b$(z))
550 next z:gosub 2130:forz=6to 136 step5:nb=nb+asc(b$(z)):next z:goto 600
560 df$=b$(165)+b$(166):nb=0:forz=4to140step4:ifz<>72then nb=nb+asc(b$(z))
565 next z
570 ifasc(b$(3))=128thenforz=221to255:nb=nb+asc(b$(z)):nextz:df$=df$+"-ds"
580 dn$="": for z=144 to 159: dn$=dn$+b$(z): next z
590 s$=b$(162): if b$(163)<>chr$(0) then s$=s$+b$(163)
600 di$=left$(s$+" ",2): u1=-1: u2=nx: if nx=0 then 680
610 c$=di$+dn$: for x=0 to nx-1: if c$<x$(x) then 670
620 ifc$<>x$(x)thennextx:goto680
630 u1=x:x=nx:next x:print"[147]*** warning ***[146] this disk id: ";di$;"[146]"
640 print"disk name: ";dn$: print"is all ready cataloged.": gosub 1990
650 print"cataloging this disk":print"will delete the previous data!"
660 gosub 1990: print"ok to recatalog this disk";: gosub 2020: goto 690
670 u2=x:x=nx:next x
680 gosub2000
690 ifc$="n"then430
700 gosub 1990: print"reading directory entries ...": nf=0
710 t1=t: t=asc(b$(0)): s1=s: s=asc(b$(1)): if t=0 then 860
720 if t=t1 and s=s1 then 820
730 gosub 2140: for z=2 to 226 step 32: if (asc(b$(z)) and 7)=0 then 800
740 s$="": for x=3 to 18: s$=s$+b$(z+x): next x: if nf=0 then 770
750 p=0: for x=1 to nf: if s$<mid$(d$(x),2,16) then p=x: x=nf
760 next x: if p>0 then 780
770 p=nf+1: goto 790
780 for y=nf to p step -1: d$(y+1)=d$(y): next y
790 d$(p)=b$(z)+s$+b$(z+28)+b$(z+29): nf=nf+1
800 if nf<=mf then next z: goto 710
810 z=226: next z
820 print"[147] *** disk directory is invalid ***[146]"
830 gosub 1990: print" current disk cannot be cataloged!"
840 print"too many entries or non-standard format"
850 gosub 1940: goto 430
860 close 5: gosub 2340: gosub 1990: print"updating master directory ..."
870 if u1>-1 then x=u1: goto 920
880 x=u2: if x=nx then 900
890 for y=nx-1 to x step -1: x$(y+1)=x$(y): u(y+1,1)=u(y,1): next y
900 for y=0 to nx+1: if u(y,2)=1 then next y
910 u(y,2)=1: u(x,1)=y: x$(x)=di$+dn$: nx=nx+1: y=nx: next y
920 gosub 1840: print#15,"s"+s$: open 5,d1,5,s$+",s,w": gosub 2260
930 print#5,df$;",";nb: gosub 2260: if nf=0 then 950
940 for x=1 to nf: print#5,d$(x): gosub 2260: next x
950 close 5: cx=1: gosub 2180: goto 430
960 print"[147]to delete disk from master directory"
970 gosub 1730: on v goto 1000,960
980 cx=1: print#15,"s"+s$: y=u(x,1): u(y,2)=0: for y=x to nx-1
990 x$(y)=x$(y+1): u(y,1)=u(y+1,1): next y: nx=nx-1: goto 960
1000 gosub 2180: goto 340
1010 print"[147]to display disk directory": gosub 1730: on v goto 340,1010
1020 gosub 2170: gosub 1880: nf=0: print#4," disk name: ";dn$
1030 print#4," disk id: ";di$;spc(8);"format: ";df$
1040 print#4,"blocks free: ";nb
1050 print#4,"---------------------------------------": if ss>0 then 1120
1060 gosub 2050: print#4,right$(" "+str$(x1+(256*x2)),4);" ";s$;" ";
1070 v=(ft and 7)*3-2: print#4,mid$(ft$,v,3);
1080 if (ft and 128)=0 then print#4," (open)";
1090 if ft>=193 then print#4," (locked)";
1100 print#4: gosub 1910: if c$="q" then 1130
1110 nf=nf+1: if ss=0 then 1060
1120 print#4: print#4,"#files: ";nf: gosub 1930
1130 close 4: close 5: goto 1010
1140 if nx=0 then gosub 1730: goto 340
1150 gosub 1980: print " 0 - return to main function menu"
1160 print" 1 - list full id useage chart"
1170 print" 2 - quick list of id's in use"
1180 print" 3 - list disk id's & names"
1190 print" 4 - list min[146] free blocks per disk"
1200 print" 5 - list max[146] free blocks per disk"
1210 gosub 1990: print"enter desired function: ";
1220 gosub 1960: if c$="0" then 340
1230 v=val(c$): if v<1 or v>5 then 1220
1240 print c$: on v goto 1250,1380,1450,1470,1500
1250 gosub 1880: gosub 2400: z=0: for x=48 to 90: if x=58 then x=65
1260 if pd=4 or x<>73 then 1300
1270 gosub 1990: print" press any key to continue, q[146] to quit"
1280 gosub 1960: if c$="q" then x=9999: next x: goto 1150
1290 print"[147]";: gosub 2400
1300 print#4,chr$(x);" ";: for y=48 to 90: if y=58 then y=65
1310 if z=nx then 1360
1320 for v=1 to 2: f$=mid$(x$(z),v,1): if f$>="0" and f$<="9" then 1340
1330 if f$<"a" or f$>"z" then z=z+1: v=2: next v: goto 1310
1340 next v: c$=chr$(x)+chr$(y): s$=left$(x$(z),2)
1350 if s$=c$ then print#4,"*";: z=z+1: goto 1370
1360 print#4,".";
1370 next y: print#4: goto 1580
1380 gosub 1880: print#4,""spc(7);"disk id's currently in use"
1390 print#4: v=12: if pd=4 then v=25
1400 z=0: for x=0 to nx-1: c$=left$(x$(x),2)
1410 if x<nx-1 then if c$=left$(x$(x+1),2) then 1430
1420 print#4,c$;" ";: z=z+1:
1430 next x: print#4: if z<>int(z/v)*v then print#4
1440 print#4,z;"id's,";nx;"disks cataloged":print#4:gosub 1930:goto 1150
1450 gosub 1880: gosub 2430
1460 for x=0 to nx-1: print#4,left$(x$(x),2);" ";mid$(x$(x),3): goto 1580
1470 gosub 1990: print"enter minimum number of free blocks"
1480 input"to be displayed0[157][157][157]";s$: vf=0: y=0: if s$="0" then 1530
1490 goto 1520
1500 gosub 1990: print"enter maximum number of free blocks"
1510 input"to be displayed99[157][157][157][157]";s$: vf=1
1520 y=val(s$): if y=0 then 1150
1530 gosub 1880: print#4,"#blks free ";: gosub 2430
1540 for x=0 to nx-1: gosub 1830: gosub 2170: close 5
1550 if (vf=0) then if (nb<=y) then 1580
1560 if (vf=1) then if (nb>=y) then 1580
1570 print#4,right$(" "+str$(nb),7);spc(5);di$;" ";dn$
1580 gosub 1910: if c$="q" then x=9999: next x: goto 1150
1590 next x: print: gosub 1930: goto 1150
1600 if nx=0 then gosub 1730:goto 340
1610 close 4:print"[147]to find what disk(s) a file is on"
1620 input"enter file name.[157][157][157]";f$: if f$="." then 340
1630 if f$="*" then print: print"re-";: goto 1620
1640 s$=f$: gosub 1850: v=y: gosub 1880
1650 print#4,"...file name.... ";: gosub 2430
1660 print#4,s$: print#4: for x=0 to nx-1: gosub 1830: gosub 2170
1670 gosub 2050: if f$<left$(s$,v) then 1710
1680 if f$=left$(s$,v) then print#4,s$;" ";di$;" ";dn$
1690 gosub 1910: if c$="q" then close 5: x=nx: next x: goto 1610
1700 if ss=0 then 1670
1710 close 5: next x: print: gosub 1930: goto 1610
1720 rem ***** subroutines *****
1730 v=3:if nx=0 then print"[147]no entries";: v=1: goto 1820
1740 input"enter disk name.[157][157][157]";f$: if f$="." then 1760
1750 gosub 1850: z=3: goto 1780
1760 input"enter disk id.[157][157][157]";f$: if f$="." then v=1: return
1770 f$=left$(f$+" ",2): y=2: z=1
1780 for x=0 to nx-1: if y>0 then if f$<>mid$(x$(x),z,y) then 1800
1790 gosub 1830: gosub 2000: if c$="y" then z=x: x=nx: next x: x=z: return
1800 next x
1810 print"not";: v=2
1820 print" in master directory!": goto 1940